package cn.itrip.auth.service;

import cn.itrip.beans.pojo.ItripUser;
import cn.itrip.beans.vo.TokenVO;
import cn.itrip.dao.ItripUserMapper;
import cn.itrip.utlis.MD5;
import cn.itrip.utlis.TokenUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginService {
    @Autowired
    private TokenUtil  tokenUtil;
    @Autowired
    private ItripUserMapper itripUserMapper;

    public ItripUser login(String name, String password) {
        return itripUserMapper.login(name, MD5.md5(password));
    }

    public TokenVO createToken(ItripUser user, String userAgent) {
        return tokenUtil.createToken(user ,userAgent);
    }
}
